package com.kangye.game.service.impl;

import com.github.pagehelper.PageHelper;
import com.kangye.game.dao.UserDao;
import com.kangye.game.pojo.TUser;
import com.kangye.game.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.sound.midi.Soundbank;
import java.util.List;

/**
 * @program: GameProject
 * @description:
 * @author: szq
 * @create: 2021-09-02 10:40
 **/
@Service
public class UserServiceImpl implements UserService {

    @Resource
    private UserDao userDao;


    @Override
    public List<TUser> findAllList(int num, int size) {
        PageHelper.startPage(num, size);
        List<TUser> lists = userDao.findAllList(num, size);
        if (lists != null) {
            System.out.println(1);
            return lists;
        } else {
            System.out.println(2);
            return null;
        }
    }

    @Override
    public int findCount() {
        return userDao.findCount();
    }

    @Override
    public int addUser(TUser user) {
        int a = userDao.addUser(user);
        return a;
    }

    @Override
    public TUser findOne(int id) {
        return userDao.findOne(id);
    }

    @Override
    public int updUser(TUser user) {

        return userDao.updUser(user);
    }

    @Override
    public void delUser(int id) {
        userDao.delUser(id);
    }

    @Override
    public List<TUser> findLike(String username) {
        return userDao.findLike(username);
    }
}